GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 86eabc...c09291 )
by Steeven
08:41
created

gearToolbar.showTab   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 25
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 20
nc 4
nop 1
dl 0
loc 25
rs 9.4
c 1
b 0
f 0
1
/*
2
 * This file is part of the O2System Framework package.
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @author         Steeve Andrian Salim
8
 * @copyright      Copyright (c) Steeve Andrian Salim
9
 */
10
// ------------------------------------------------------------------------
11
var gearToolbar = {
12
13
    tabActive: null,
14
15
    init: function () {
16
        var buttons = document.querySelectorAll('.gear-toolbar-tab');
17
18
        for (var i = 0; i < buttons.length; i++) {
19
            buttons[i].addEventListener('click', gearToolbar.showTab, false);
20
        }
21
    },
22
23
    //--------------------------------------------------------------------
24
25
    showTab: function (tabId) {
26
        var tabs = document.querySelectorAll('.tab');
27
        var tabButtons = document.querySelectorAll('.tab-button');
28
        var tabContainer = document.getElementById('gear-toolbar-tabs');
29
        var tabActive = document.getElementById('gear-toolbar-tab-' + tabId);
30
        var tabButtonActive = document.getElementById('tab-button-' + tabId);
31
32
        if (gearToolbar.tabActive === tabId) {
33
            if (tabContainer.classList.contains('show')) {
34
                tabActive.classList.remove('show');
35
                tabContainer.classList.remove('show');
36
                tabButtonActive.classList.remove('active');
37
            }
38
            gearToolbar.tabActive = null;
39
        } else {
40
            for (var i = 0; i < tabs.length; i++) {
41
                tabs[i].classList.remove('show');
42
                tabButtons[i].classList.remove('active');
43
            }
44
            gearToolbar.tabActive = tabId;
45
            tabContainer.classList.add('show');
46
            tabActive.classList.add('show');
47
            tabButtonActive.classList.add('active');
48
        }
49
    },
50
51
    //--------------------------------------------------------------------
52
53
    addClass: function (el, className) {
54
        if (el.classList) {
55
            el.classList.add(className);
56
        } else {
57
            el.className += ' ' + className;
58
        }
59
    },
60
61
    //--------------------------------------------------------------------
62
63
    removeClass: function (el, className) {
64
        if (el.classList) {
65
            el.classList.remove(className);
66
        } else {
67
            el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
68
        }
69
70
    },
71
72
    //--------------------------------------------------------------------
73
74
    /**
75
     * Toggle display of a data table
76
     * @param obj
77
     */
78
    toggleDataTable: function (obj) {
79
        if (typeof obj == 'string') {
80
            obj = document.getElementById(obj + '_table');
81
        }
82
83
        if (obj) {
84
            obj.style.display = obj.style.display == 'none' ? 'block' : 'none';
85
        }
86
    },
87
88
    //--------------------------------------------------------------------
89
90
    /**
91
     *   Toggle tool bar from full to icon and icon to full
92
     */
93
    toggleToolbar: function () {
94
        var tabs = document.querySelectorAll('.tab');
0 ignored issues
show
Unused Code introduced by
The variable tabs seems to be never used. Consider removing it.
Loading history...
95
        var tabContainer = document.getElementById('gear-toolbar-tabs');
96
97
        if (tabContainer.classList.contains('show')) {
98
            tabContainer.classList.remove('show');
99
        } else {
100
            tabContainer.classList.add('show');
101
            if (gearToolbar.tabActive === null) {
102
                gearToolbar.showTab('metrics');
103
            }
104
        }
105
    },
106
107
    //--------------------------------------------------------------------
108
};
109